home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_10 / 9n10038a < prev    next >
Text File  |  1991-08-14  |  965b  |  51 lines

  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include "c_calls.h"
  6.  
  7. /* Allocate enough stack space to support recursion. */
  8. #ifdef __TURBOC__
  9. extern unsigned _stklen = 32000;
  10. #endif
  11.  
  12. void main(int argc, char *argv[])
  13. {
  14. LIST fcn_list = NULL;
  15.  
  16. if (argc != 2)
  17.      error("c_calls:  usage:  c_calls <.asm filename>");
  18.  
  19. build_graph(&fcn_list, argv[1]);  /* Determine calling relationships. */
  20.  
  21. if (fcn_list != NULL)
  22.      print_all_calls(fcn_list);  /* Print the fcn call tree. */
  23. }
  24.  
  25.  
  26. void error(const char *message)
  27.  
  28. /* Exit after giving an error message. */
  29.  
  30. {
  31. printf("Error:  %s\n", message);
  32. exit(-1);
  33. }
  34.  
  35.  
  36. int namecmp(const char *name1, const char *name2)
  37.  
  38. /*
  39. Identical to stricmp, except that "main" is considered
  40. less than any other string.
  41. */
  42.  
  43. {
  44. if (stricmp(name1, "main") == 0)
  45.      return -1;
  46. else
  47.      if (stricmp(name2, "main") == 0)
  48.           return 1;
  49.      else return stricmp(name1, name2);
  50. }
  51.